module AssignationsHelper
	def member_column(record)
		record.member.lastname + ", " + record.member.name
	end 
	def member_form_column(record, input_name)
		#collection_select("record[member]", "id", Member.find(:all), :id, :complete_name, {:prompt => "-select-"})
                collection_select("record[member]", "id", Member.find_by_sql("SELECT * from members where id not in (select member_id from assignations where active=1)"), :id, :complete_name, {:prompt => "-select-"})
	end   
	def position_form_column(record, input_name)
		collection_select("record[position]", "id", Position.find_by_sql("SELECT * from positions where id not in (select position_id from assignations where active=1)"), :id, :complete_position_name, {:prompt => "-select-"})
	end 
	def assignation_date_column(record)
		record.assignation_date.strftime("%b-%d-%Y")
	end
	def ovposition_form_column(record, input_name)
		collection_select("record[ovposition]", "id", Ovposition.find_by_sql("SELECT * from ovpositions"), :id, :name, {:prompt => "-select-"})
	end 
end
